樣板 B 樹 ( B - tree )
規則 :
(1) 每個節點內元素個數在 [MIN,2*MIN] 之間, 但根節點元素個數為 [1,2*MIN]
(2) 節點內元素由小排到大, 元素不重複
(3) 每個節點內的指標個數為元素個數加一
(4) 第 i 個指標所指向的子節點內的所有元素值皆小於父節點的第 i 個元素
(5) B 樹內的所有末端節點深度一樣
1) Write a function reverse(A) which takes a matrix A of arbitrary dimensions as input and returns a matrix B consisting of the columns of A in reverse order. Thus for example, if
A = 1 2 3 then B = 3 2 1
4 5 6 6 5 4
7 8 9 9 8 7
Write a main program to call reverse(A) for the matrix A = magic(5). Print to the screen both A and reverse(A).
2) Write a program which accepts an input k from the keyboard, and which prints out the smallest fibonacci number that is at least as large as k. The program should also print out its position in the fibonacci sequence. Here is a sample of input and output:
Enter k>0: 100
144 is the smallest fibonacci number greater than or equal to 100.
It is the 12th fibonacci number.